﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BuisnessLayer
{
	public class UserInteract
	{
        public static string AskStringData(AskerMessage pMessage)
	    {
            return AskDataFromUser(pMessage);
	    }

        public static int AskIntegerData(AskerMessage pMessage)
	    {
	        try
	        {
                return Int32.Parse(AskDataFromUser(pMessage));
	        }
	        catch (Exception)
	        {
	            return 0;
	        }
	    }

        private static string AskDataFromUser(AskerMessage pMessage)
        {
            var dialog = new TargetAsker(pMessage);
            if (dialog.ShowDialog()==true)
            {
                return dialog.ResponseText;
            }
            return String.Empty;
        }
	}
}
